package com.example.test.自己的责任连;

public class HandelChain {

    private AbstractHandel head;

    private AbstractHandel tail;

    public void addChain(AbstractHandel abstractHandel) {
        if (head == null) {
            head = abstractHandel;
            tail = abstractHandel;
            return;
        }

        tail.setNext(abstractHandel);
        tail = abstractHandel;

    }

    public void chainDoHandel(int num) {
        if (head != null) {
            head.start(num);
        }
    }

}
